<%@ page import="com.mySql.Book" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 17126
  Date: 2022/5/14
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.mySql.Book" %>
<%@ page import="java.util.List" %>
<html>
<head>
    <title>显示图书</title>
</head>
<body>
<table align="center" width="450" border="1" height="180" bordercolor="white">
    <tr bgcolor="white">
        <td align="center" colspan="7">
            <h2>所有图书信息</h2>
        </td>
    </tr>
    <tr align="center" bgcolor="#e1ffc1">
        <td><b>ID</b></td>
        <td><b>图书名称</b></td>
        <td><b>价格</b></td>
        <td><b>数量</b></td>
        <td><b>作者</b></td>
        <td><b>修改内容</b></td>
        <td><b>删除</b></td>
    </tr>
    <%
        List<Book> list = (List<Book>) request.getAttribute("list");
        if (list == null || list.size() < 1) {
            out.print("没有数据！");
        } else {
            for (Book book : list) {
    %>
    <tr align="center" bgcolor="white">
        <td><%=book.getId()%>
        </td>
        <td><%=book.getName()%>
        </td>
        <td><%=book.getPrice()%>
        </td>
        <td><%=book.getCount()%>
        </td>
        <td><%=book.getAuthor()%>
        </td>
        <td align="center">
            <form action="upDateServlet" method="post">
                <input type="hidden" name="id" value="<%=book.getId()%>">
                <input type="text" name="count" size="3">
                <input type="submit" value="修改">
            </form>
        </td>
        <td >
            <a align="center" href="deleteServlet?id=<%=book.getId()%>">删除</a>
        </td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>
